
clear
set more off
cd "/Users/michaelflynn/Dropbox/Projects/Aid and NGOs/Data"
use "ngoaiddata.dta", clear

set matsize 2000
drop if dyad==.
xtset dyad year

reg F.lnratio govtecon socgdp1Ml  growth post08 s3un defense physint polity2 loggdppc governance_all_mean prio2 lnall exports_percent colony lnratio, robust

keep if e(sample)

sort ccode1 year

by ccode1 year: egen recipientcount = count(ccode2)

keep donor recipientcount

collapse (median) recipientcount, by(donor)

label var donor "Donor State"
label var recipientcount "Median Recipients"
sort donor
gen num = _n
order num donor recipient

listtex num donor recipientcount using table_countrylist.tex,  replace ///
delimiter("&") headlines("\begin{tabular}{| l | l | c |}" "\hline" "\# & Donor State & Median Recipients \\ \hline" ) ///
footlines("\hline" "\end{tabular}") type rstyle(tabular)
